<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'activity.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    This is my JSP page. <br>
    <script src="js/jquery-1.11.3.min.js"></script>
	<script type="text/javascript">
	$(document).ready(function queryActivitys() {
		$.ajax({
			url:"activity/querypackages.do",
			dataType:"json",
            type: 'get',  
            success: function (data) {
            	var table = $("#table");
                table.empty();
                table.append("<thead><tr height='30px'><th>序号</th><th>活动名称</th><th>操作</th></tr></thead><tbody>");
	           	for (var i=0;i<data.length;i++) {
	           		 var object = data[i];
	           		 table.append('<tr><td>'+(i+1)+'</td>+<td>'+object.packageName+'</td><td>修改</td> 查看结果</td></tr>');
	           	 }
	           	 table.append("</tbody>");
            }
		});
	});
	
	function Activitysave() {
		var activityName = $('#activityName').val();
		var activityContent = $('#activityContent').val();
		console.log(activityContent,activityName);
		$.ajax({
			url : "saveActivity.do",
			data : {
				activityName :  $('#activityName').val(),
				activityContent : $('#activityContent').val(),
			},
			dataType : "json",
			type : 'POST',
			success : function(data) {
				
			}
		});
	}
	</script>
    <div>
    	<span>活动名称：</span><input type="text" name="activityName" id="activityName">
    </div>
    <div>
    	<span>提问内容：</span><input type="text" name="activityContent" id="activityContent">
    </div>
    <div>
    	<span>部门:</span>
    	<div>
    	<input type="checkbox"  name="activityDepart" id="activityDepart" value="01">研发部
    	<input type="checkbox"  name="activityDepart" id="activityDepart" value="02">人事部
		<input type="checkbox"  name="activityDepart" id="activityDepart" value="03">运营部
    	</div>
    </div>
    <div> 
    	<span>套餐：</span><input type="button" name="addPackage" id="addPackage" value="增加套餐" onclick="javascript:window.location.href='goods.jsp'">
    	<input type="button" name="delPackage" id="delPackage" value="删除套餐">
    	
    </div>
    <div>
    	<table id="table">
    		<thead></thead>
    		<tbody>
    			
    			
    		</tbody>
    	</table>
    </div>
    <div>
    	<input type="button" name="activitySave" id="activitySave" value="保存" onclick="Activitysave()"> 
    	<input type="button" name="creatUrl" id="creatUrl" value="生成链接"> 
    </div>
  </body>
</html>
